package com.zsc.wxm.ysh.anjo.service.base.exception;

import com.zsc.wxm.ysh.anjo.result.CodeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义异常
 * @author playmaker
 * @Since 2021/1/11
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class AnjoException extends RuntimeException {

    private Integer code;


    public AnjoException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public AnjoException(CodeEnum codeEnum) {
        super(codeEnum.getMessage());
        this.code = codeEnum.getCode();
    }

    @Override
    public String toString() {
        return "AnjoException{" +
                "code=" + code + ",message=" + this.getMessage() +
                '}';
    }
}
